using UnityEngine;
using UnityEngine.UI;
using QFramework;
using UnityEngine.SceneManagement;

namespace Survivor
{
	public class UIGameStartPanelData : UIPanelData
	{
	}
	public partial class UIGameStartPanel : UIPanel,IController
	{
		protected override void OnInit(IUIData uiData = null)
		{
			mData = uiData as UIGameStartPanelData ?? new UIGameStartPanelData();

			// please add init code here
			BtnStart.onClick.AddListener(() =>
			{
				SceneManager.LoadScene("SampleScene");
				Hide();
			});
			
			BtnUpgrade.onClick.AddListener(() =>
			{
				UpgradePanel.Show();
			});
			
			BtnExit.onClick.AddListener(() =>
			{
#if UNITY_EDITOR
				UnityEditor.EditorApplication.isPlaying = false;
#else
				Application.Quit();
#endif
			}
			);
		}
		
		protected override void OnOpen(IUIData uiData = null)
		{
			UIKit.HidePanel<UIGamePanel>();
		}
		
		protected override void OnShow()
		{
		}
		
		protected override void OnHide()
		{
		}
		
		protected override void OnClose()
		{
		}
		
		public IArchitecture GetArchitecture()
		{
			return Global.Interface;
		}
	}
}
